package com.gouqi.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gouqi.common.DeleteRequest;
import com.gouqi.common.ReviewRequest;
import com.gouqi.model.dto.app.AppAddRequest;
import com.gouqi.model.dto.app.AppEditRequest;
import com.gouqi.model.dto.app.AppQueryRequest;
import com.gouqi.model.dto.app.AppUpdateRequest;
import com.gouqi.model.entity.App;
import com.gouqi.model.vo.AppVO;

import javax.servlet.http.HttpServletRequest;

public interface AppService extends IService<App> {

    /**
     * 校验数据
     *
     * @param app
     * @param add 对创建的数据进行校验
     */
    void validApp(App app, boolean add);

    /**
     * 添加应用
     * @param appAddRequest
     * @param request
     * @return
     */
    long addApp(AppAddRequest appAddRequest, HttpServletRequest request);

    /**
     * 删除应用
     * @param deleteRequest
     * @param request
     */
    void deleteApp(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 更新应用
     * @param appUpdateRequest
     */
    void updateApp(AppUpdateRequest appUpdateRequest);

    /**
     * 根据id获取应用封装
     * @param id
     * @param request
     * @return
     */
    AppVO getAppVO(long id, HttpServletRequest request);

    /**
     * 获取查询条件
     *
     * @param appQueryRequest
     * @return
     */
    LambdaQueryWrapper<App> getQueryWrapper(AppQueryRequest appQueryRequest);

    /**
     * 获取应用封装
     *
     * @param app
     * @param request
     * @return
     */
    AppVO getAppVO(App app, HttpServletRequest request);

    /**
     * 分页获取应用封装
     *
     * @param appPage
     * @param request
     * @return
     */
    Page<AppVO> getAppVOPage(Page<App> appPage, HttpServletRequest request);

    /**
     * 分页获取应用列表（管理员）
     * @param appQueryRequest
     * @return
     */
    Page<App> getAppPage(AppQueryRequest appQueryRequest);

    /**
     * 分页获取当前登录用户创建的应用列表
     * @param appQueryRequest
     * @param request
     * @return
     */
    Page<AppVO> listMyAppVOByPage(AppQueryRequest appQueryRequest, HttpServletRequest request);

    /**
     * 编辑应用（用户个人使用）
     * @param appEditRequest
     * @param request
     */
    void editApp(AppEditRequest appEditRequest, HttpServletRequest request);

    /**
     * 分页获取应用列表（封装类）
     * @param appQueryRequest
     * @param request
     * @return
     */
    Page<AppVO> listAppVOByPage(AppQueryRequest appQueryRequest, HttpServletRequest request);

    /**
     * 审核应用
     *
     * @param reviewRequest
     * @param request
     */
    void doAppReview(ReviewRequest reviewRequest, HttpServletRequest request);
}
